Skip to content

Conversation

@craigtaverner
Copy link
Contributor

Manual backport of #128259

…tudes (elastic#128259)

It turns out in elastic#128234 that Lucene pushdown on ST_DISTANCE with invalid points (latitude out of range) will cause all documents to be returned, since DISJOINT on an invalid circle is true for all documents. We could either add an extra check for spatial pushdown that the geometries are valid, or add validation at geometry creation. This second option is much easier to implement, and a more comprehensive approach, as it prevents invalid geometries in many more places, hopefully reducing the likelihood of subtle and obscure bugs like elastic#128234 happening in future.
@craigtaverner craigtaverner added :Analytics/Geo Indexing, search aggregations of geo points and shapes backport Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport Automatically create backport pull requests when merged v8.19.0 v8.17.8 v8.18.3 labels May 25, 2025
@craigtaverner craigtaverner changed the title Added geometry validation for GEO types to exit early on invalid latitudes (#128259) [8.19] Added geometry validation for GEO types to exit early on invalid latitudes (#128259) May 25, 2025
@elasticsearchmachine elasticsearchmachine merged commit a17bd13 into elastic:8.19 May 25, 2025
15 checks passed
@craigtaverner craigtaverner deleted the 8.19_backport128259 branch May 25, 2025 11:00
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.17 Commit could not be cherrypicked due to conflicts
8.18

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 128426

craigtaverner added a commit to craigtaverner/elasticsearch that referenced this pull request May 25, 2025
…tudes (elastic#128259) (elastic#128426)

It turns out in elastic#128234 that Lucene pushdown on ST_DISTANCE with invalid points (latitude out of range) will cause all documents to be returned, since DISJOINT on an invalid circle is true for all documents. We could either add an extra check for spatial pushdown that the geometries are valid, or add validation at geometry creation. This second option is much easier to implement, and a more comprehensive approach, as it prevents invalid geometries in many more places, hopefully reducing the likelihood of subtle and obscure bugs like elastic#128234 happening in future.
elasticsearchmachine pushed a commit that referenced this pull request May 25, 2025
…tudes (#128259) (#128426) (#128427)

It turns out in #128234 that Lucene pushdown on ST_DISTANCE with invalid points (latitude out of range) will cause all documents to be returned, since DISJOINT on an invalid circle is true for all documents. We could either add an extra check for spatial pushdown that the geometries are valid, or add validation at geometry creation. This second option is much easier to implement, and a more comprehensive approach, as it prevents invalid geometries in many more places, hopefully reducing the likelihood of subtle and obscure bugs like #128234 happening in future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Geo Indexing, search aggregations of geo points and shapes auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport pending backport Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.17.8 v8.18.3 v8.19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants